package com.collect.cameroon.zhiScene.zhiRemind.zhiCustomer.zhiAdmin.zhiPerformance.zhiBonusRules;

import android.annotation.SuppressLint;
import android.graphics.Typeface;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.StyleSpan;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.collect.cameroon.MyApplication;
import com.collect.cameroon.R;
import com.collect.cameroon.zhiBase.BaseActivity;
import com.collect.cameroon.zhiGlobal.zhiAppSettings.ZHIProjectRouter;
import com.collect.cameroon.zhiScene.zhiWidget.zhiNavigationBar.ZHINavigationBar;

import butterknife.BindView;

@SuppressLint("NonConstantResourceId")
@Route(path = ZHIProjectRouter.ZHI_PERFORMANCE_CUSTOMER_BONUS_RULES_ADMIN)
public class ZHICustomerBonusRulsAdminActivity extends BaseActivity {

    @BindView(R.id.navigationBar)
    ZHINavigationBar navigationBar;

    @BindView(R.id.tv_main_title)
    TextView tv_main_title;

    @BindView(R.id.tv_rule1_des)
    TextView tv_rule1_des;

    @BindView(R.id.tv_rule2_des)
    TextView tv_rule2_des;

    @BindView(R.id.tv_rule3_des)
    TextView tv_rule3_des;

    @BindView(R.id.tv_rule4_des)
    TextView tv_rule4_des;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_customer_bonus_rules;
    }

    @Override
    protected void initInjector() {

    }

    @Override
    protected void initView() {
        try {
            navigationBar.showLeft().hideRight().setCenterText(getString(R.string.page_bonus_rules)).setBarClickListener(new ZHINavigationBar.OnNavigationBarClickListener() {
                @Override
                public void onNavigationBarLeftClick(View v) {
                    finish();
                }

                @Override
                public void onNavigationBarRightClick(View v) {
                }
            });

            String mtline0 = MyApplication.getAppContext().getString(R.string.monthly_collection_rate_equal);
            String mtline1 = "50%";
            String mtline2 = MyApplication.getAppContext().getString(R.string.dot_will_be_rewarder_with);
            String mtline3 = "10000F";
            String mtline4 = MyApplication.getAppContext().getString(R.string.dot_the_part_that_exceeds);
            String mtline5 = "50%";
            String mtline6 = MyApplication.getAppContext().getString(R.string.dot_every_additional);
            String mtline7 = "2%";
            String mtline8 = MyApplication.getAppContext().getString(R.string.dot_will_be_rewarder_with);
            String mtline9 = "3000F";
            String mtline10 = MyApplication.getAppContext().getString(R.string.dot_less_than);
            String mtline11 = MyApplication.getAppContext().getString(R.string.dot_not_calculated);
            String mtlinefull = (mtline0 + mtline1 + mtline2 + mtline3 + mtline4 + mtline5 + mtline6 + mtline7 + mtline8 + mtline9 + mtline10 + mtline11);
            SpannableStringBuilder builder0 = new SpannableStringBuilder(mtlinefull);
            builder0.setSpan(new StyleSpan(Typeface.BOLD), mtline0.length(), mtline0.length() + mtline1.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            builder0.setSpan(new StyleSpan(Typeface.BOLD), mtline0.length() + mtline1.length() + mtline2.length(), mtline0.length() + mtline1.length() + mtline2.length() + mtline3.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            builder0.setSpan(new StyleSpan(Typeface.BOLD), mtline0.length() + mtline1.length() + mtline2.length() + mtline3.length() + mtline4.length(), mtline0.length() + mtline1.length() + mtline2.length() + mtline3.length() + mtline4.length() + mtline5.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            builder0.setSpan(new StyleSpan(Typeface.BOLD), mtline0.length() + mtline1.length() + mtline2.length() + mtline3.length() + mtline4.length() + mtline5.length() + mtline6.length(), mtline0.length() + mtline1.length() + mtline2.length() + mtline3.length() + mtline4.length() + mtline5.length() + mtline6.length() + mtline7.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            builder0.setSpan(new StyleSpan(Typeface.BOLD), mtline0.length() + mtline1.length() + mtline2.length() + mtline3.length() + mtline4.length() + mtline5.length() + mtline6.length() + mtline7.length() + mtline8.length(), mtline0.length() + mtline1.length() + mtline2.length() + mtline3.length() + mtline4.length() + mtline5.length() + mtline6.length() + mtline7.length() + mtline8.length() + mtline9.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            tv_main_title.setText(builder0);

            String ex1line0 = MyApplication.getAppContext().getString(R.string.if_you_collect_more_1);
            String ex1line1 = "50%";
            String ex1line2 = MyApplication.getAppContext().getString(R.string.less);
            String ex1line3 = "52%";
            String ex1line4 = MyApplication.getAppContext().getString(R.string.per_month_so_the_bonus_this_month_is);
            String ex1linefull = (ex1line0 + ex1line1 + ex1line2 + ex1line3 + ex1line4);
            SpannableStringBuilder builder1 = new SpannableStringBuilder(ex1linefull);
            builder1.setSpan(new StyleSpan(Typeface.BOLD), ex1line0.length(), ex1line0.length() + ex1line1.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            builder1.setSpan(new StyleSpan(Typeface.BOLD), ex1line0.length() + ex1line1.length() + ex1line2.length(), ex1line0.length() + ex1line1.length() + ex1line2.length() + ex1line3.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            tv_rule1_des.setText(builder1);

            String ex2line0 = "2:" + MyApplication.getAppContext().getString(R.string.if_you_collect_more);
            String ex2line1 = "52%";
            String ex2line2 = MyApplication.getAppContext().getString(R.string.less);
            ;
            String ex2line3 = "54%";
            String ex2line4 = MyApplication.getAppContext().getString(R.string.per_month_so_the_bonus_this_month_is);
            String ex2linefull = (ex2line0 + ex2line1 + ex2line2 + ex2line3 + ex2line4);
            SpannableStringBuilder builder2 = new SpannableStringBuilder(ex2linefull);
            builder2.setSpan(new StyleSpan(Typeface.BOLD), ex2line0.length(), ex2line0.length() + ex2line1.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            builder2.setSpan(new StyleSpan(Typeface.BOLD), ex2line0.length() + ex2line1.length() + ex2line2.length(), ex2line0.length() + ex2line1.length() + ex2line2.length() + ex2line3.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            tv_rule2_des.setText(builder2);

            String ex3line0 = "3:" + MyApplication.getAppContext().getString(R.string.if_you_collect_more);
            String ex3line1 = "54%";
            String ex3line2 = MyApplication.getAppContext().getString(R.string.less);
            ;
            String ex3line3 = "56%";
            String ex3line4 = MyApplication.getAppContext().getString(R.string.per_month_so_the_bonus_this_month_is);
            String ex3linefull = (ex3line0 + ex3line1 + ex3line2 + ex3line3 + ex3line4);
            SpannableStringBuilder builder3 = new SpannableStringBuilder(ex3linefull);
            builder3.setSpan(new StyleSpan(Typeface.BOLD), ex3line0.length(), ex3line0.length() + ex3line1.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            builder3.setSpan(new StyleSpan(Typeface.BOLD), ex3line0.length() + ex3line1.length() + ex3line2.length(), ex3line0.length() + ex3line1.length() + ex3line2.length() + ex3line3.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            tv_rule3_des.setText(builder3);

            String ex4line0 = "4:" + MyApplication.getAppContext().getString(R.string.if_you_collect_more);
            ;
            String ex4line1 = "54%";
            String ex4line2 = MyApplication.getAppContext().getString(R.string.less);
            ;
            String ex4line3 = "56%";
            String ex4line4 = MyApplication.getAppContext().getString(R.string.per_month_so_the_bonus_this_month_is);
            String ex4linefull = (ex4line0 + ex4line1 + ex4line2 + ex4line3 + ex4line4);
            SpannableStringBuilder builder4 = new SpannableStringBuilder(ex4linefull);
            builder4.setSpan(new StyleSpan(Typeface.BOLD), ex4line0.length(), ex4line0.length() + ex4line1.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            builder4.setSpan(new StyleSpan(Typeface.BOLD), ex4line0.length() + ex4line1.length() + ex4line2.length(), ex4line0.length() + ex4line1.length() + ex4line2.length() + ex4line3.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            tv_rule4_des.setText(builder4);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
